<%@ taglib prefix="jaxson" uri="http://jaxson.org/base" %>

<html>
<head>

<script language="javascript">
<!--//

// Import the base jaxson javascript
<jaxson:import>
Base;
</jaxson:import>

function doAjax()
{
	var params = {
		returnAs: "json",
		"model.origin": "The Browser (" + navigator.userAgent + ")",
		"model.message": document.getElementById( "msgField" ).value
	}

	var xhr = new org.jaxson.util.http.XHR();
	xhr.setMethod( "POST" );
	xhr.oncomplete = function(){ 
		var response = this.evalResponse();
		alert( response.message + " " + response.origin ); 
	};
	
	xhr.setRequestParameters( params );
	xhr.doRequest( "<%= request.getContextPath() %>/helloWorld.action" );
}
//-->
</script>

</head>

<body>

<pre>
<input type="text" name="msg" id="msgField" /> <input type="button" value="Do Ajax" onclick="doAjax();" />
</pre>

</body>

</html>